package com.sms;

import java.text.SimpleDateFormat;
import java.util.Date;

public class SmsUtil {

    //发送验证码(验证码:${code},20分钟内有效,感谢您选择云美集,非本人操作请忽略本短信.)
    public static String sendCode(String mobile, String code) {
        try {
            String TemplateParam = "{\"code\":\"" + code + "\"}";
            return SmsClient.sendSms(mobile, "SMS_180046111", TemplateParam);
        } catch (Exception e) {
            e.printStackTrace();
            return e.getMessage();
        }
    }

    public static String sendVipMsg(String mobile) {
        try {
            String TemplateParam = "{}";
            return SmsClient.sendSms(mobile, "SMS_180350291", TemplateParam);
        } catch (Exception e) {
            e.printStackTrace();
            return e.getMessage();
        }
    }

    public static String sendBillMsg(String mobile, Date reserveStartTime, Date reserveEndTime, String hotelName, String homeName, String address, String hotelTelNo) {
        try {
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String TemplateParam = "{\"reserveStartTime\":\"" + formatter.format(reserveStartTime) + "\",\"reserveEndTime\":\"" + formatter.format(reserveEndTime) + "\",\"hotelName\":\"" + hotelName + "\",\"homeName\":\"" + homeName + "\",\"hotelAddress\":\"" + address + "\",\"hotelTelNo\":\"" + hotelTelNo + "\"}";
            return SmsClient.sendSms(mobile, "SMS_180345104", TemplateParam);
        } catch (Exception e) {
            e.printStackTrace();
            return e.getMessage();
        }
    }

    public static String sendManageMsg(String mobile, Date reserveStartTime, Date reserveEndTime, String hotelName, String homeName, String hotelTelNo) {
        try {
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String TemplateParam = "{\"hotelName\":\"" + hotelName + "\",\"account\":\"" + mobile + "\",\"reserveStartTime\":\"" + formatter.format(reserveStartTime) + "\",\"reserveEndTime\":\"" + formatter.format(reserveEndTime) + "\",\"homeName\":\"" + homeName + "\"}";
            return SmsClient.sendSms(hotelTelNo, "SMS_190728647", TemplateParam);
        } catch (Exception e) {
            e.printStackTrace();
            return e.getMessage();
        }
    }

    public static String cancelBillMsg(String mobile, Date reserveStartTime, Date reserveEndTime, String hotelName, String homeName) {
        try {
            SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
            String TemplateParam = "{\"reserveStartTime\":\"" + formatter.format(reserveStartTime) + "\",\"reserveEndTime\":\"" + formatter.format(reserveEndTime) + "\",\"hotelName\":\"" + hotelName + "\",\"homeName\":\"" + homeName + "\"}";
            return SmsClient.sendSms(mobile, "SMS_180950012", TemplateParam);
        } catch (Exception e) {
            e.printStackTrace();
            return e.getMessage();
        }
    }

    public static String checkInMsg(String mobile, String hotelName, String hotelTelNo) {
        try {
            String TemplateParam = "{\"hotelName\":\"" + hotelName + "\",\"hotelTelNo\":\"" + hotelTelNo + "\"}";
            return SmsClient.sendSms(mobile, "SMS_181655010", TemplateParam);
        } catch (Exception e) {
            e.printStackTrace();
            return e.getMessage();
        }
    }

    //
    public static String checkOutMsg(String mobile, String hotelName, String hotelTelNo) {
        try {
            String TemplateParam = "{\"hotelName\":\"" + hotelName + "\",\"hotelTelNo\":\"" + hotelTelNo + "\"}";
            return SmsClient.sendSms(mobile, "SMS_181665007", TemplateParam);
        } catch (Exception e) {
            e.printStackTrace();
            return e.getMessage();
        }
    }

    //畅游开卡短信
    public static String changyouMsg(String mobile, String cardNo, String cardPwd) {
        try {
            String TemplateParam = "{\"cardNo\":\"" + cardNo + "\",\"cardPwd\":\"" + cardPwd + "\"}";
            return SmsClient.sendSms(mobile, "SMS_181850144", TemplateParam);
        } catch (Exception e) {
            e.printStackTrace();
            return e.getMessage();
        }
    }

    //退房短信/取消押金退回短信
    public static String depositMsg(String mobile, String billNo) {
        try {
            String TemplateParam = "{\"billNo\":\"" + billNo + "\"}";
            return SmsClient.sendSms(mobile, "SMS_193236748", TemplateParam);
        } catch (Exception e) {
            e.printStackTrace();
            return e.getMessage();
        }
    }

    //退款违约短信
    public static String depositViolationMsg(String mobile, String billNo) {
        try {
            String TemplateParam = "{\"billNo\":\"" + billNo + "\"}";
            return SmsClient.sendSms(mobile, "SMS_193246722", TemplateParam);
        } catch (Exception e) {
            e.printStackTrace();
            return e.getMessage();
        }
    }
}
